﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SiteInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
//   Defines the settings needed to create a Site
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Collaboris.Saf.Actions.Wss.Entities
{
    using System;
    using System.Xml.Serialization;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [CollaborisClass(
          Title = "Site Info",
          ReleaseStatus = ReleaseStatus.Beta,
          DisableDocumentation = false,
          ContactAuthorEmail = "Support@Collaboris.co.uk",
          Remarks = "If no database information is supplied the default server and content database will be used.",
          Summary = "Defines the parameters to create a new site collection in SharePoint."
         )]
    [Serializable]
    public class SiteInfo : WSSEntityBase
    {
        #region Constants and Fields

        /// <summary>
        /// The database name.
        /// </summary>
        private string databaseName;

        /// <summary>
        /// The database password.
        /// </summary>
        private string databasePassword;

        /// <summary>
        /// The database server.
        /// </summary>
        private string databaseServer;

        /// <summary>
        /// The database user name.
        /// </summary>
        private string databaseUserName;

        /// <summary>
        /// The description.
        /// </summary>
        private string description;

        /// <summary>
        /// The locale id.
        /// </summary>
        private uint localeId;

        /// <summary>
        /// The overwrite.
        /// </summary>
        private bool overwrite;

        /// <summary>
        /// The owner email.
        /// </summary>
        private string ownerEmail;

        /// <summary>
        /// The owner login.
        /// </summary>
        private string ownerLogin;

        /// <summary>
        /// The owner name.
        /// </summary>
        private string ownerName;

        /// <summary>
        /// The secondary contact email.
        /// </summary>
        private string secondaryContactEmail;

        /// <summary>
        /// The secondary contact login.
        /// </summary>
        private string secondaryContactLogin;

        /// <summary>
        /// The secondary contact name.
        /// </summary>
        private string secondaryContactName;

        /// <summary>
        /// The title.
        /// </summary>
        private string title;

        /// <summary>
        /// The url.
        /// </summary>
        private string url;

        /// <summary>
        /// The use host header as site name.
        /// </summary>
        private bool useHostHeaderAsSiteName;

        /// <summary>
        /// The web application url.
        /// </summary>
        private string webApplicationUrl;

        /// <summary>
        /// The web template.
        /// </summary>
        private string webTemplate;

        #endregion

        #region Properties

        [CollaborisProperty(
              Summary = "Specifies the name of the database to create the site collection within.",
              Title = "Database Name",
              Example = "",
              Required = false,
              Remarks = "If this value is supplied, then ensure a value for 'DatabasePassword', 'DatabaseServer' and 'DatabaseUserName'.",
              InputHint = InputHint.SingleText)]
        [XmlAttribute] 
        public string DatabaseName
        {
            get
            {
                return this.databaseName;
            }

            set
            {
                this.databaseName = value;
            }
        }

        [CollaborisProperty(
              Summary = "Specifies the password to log-in to the database server with.",
              Title = "Database Password",
              Example = "",
              Required = false,
              Remarks = "If this value is supplied, then ensure a value for 'DatabaseName', 'DatabaseServer' and 'DatabaseUserName'.",
              InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string DatabasePassword
        {
            get
            {
                return this.databasePassword;
            }

            set
            {
                this.databasePassword = value;
            }
        }

        [CollaborisProperty(
              Summary = "Specifies the name of the database server to create the site collection within.",
              Title = "Database Server",
              Example = "true",
              Required = false,
              Remarks = "If this value is supplied, then ensure a value for 'DatabasePassword', 'DatabaseName' and 'DatabaseUserName'.",
              InputHint = InputHint.SingleText)]
        [XmlAttribute] 
        public string DatabaseServer
        {
            get
            {
                return this.databaseServer;
            }

            set
            {
                this.databaseServer = value;
            }
        }

        [CollaborisProperty(
              Summary = "Specifies the user name to log-in to the database server with.",
              Title = "Database Name",
              Example = "",
              Required = false,
              Remarks = "If this value is supplied, then ensure a value for 'DatabasePassword', 'DatabaseServer' and 'DatabaseName'.",
              InputHint = InputHint.SingleText)]
        [XmlAttribute] 
        public string DatabaseUserName
        {
            get
            {
                return this.databaseUserName;
            }

            set
            {
                this.databaseUserName = value;
            }
        }

        [CollaborisProperty(
              Summary = "Specifies the description for the new site collection.",
              Title = "Description",
              Example = "This site was created by SAF.",
              Required = false,
              InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string Description
        {
            get
            {
                return this.description;
            }

            set
            {
                this.description = value;
            }
        }

        [CollaborisProperty(
              Summary = "Specifies the locale ID for the site.",
              Title = "Locale Id",
              Example = "1033",
              Required = false,
              InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public uint LocaleId
        {
            get
            {
                return this.localeId;
            }

            set
            {
                this.localeId = value;
            }
        }

        [CollaborisProperty(
              Summary = "Specifies whether to overwrite the site if it already exists at the destination.",
              Title = "Overwrite",
              Example = "false",
              Required = false,
              InputHint = InputHint.Boolean)]
        [XmlAttribute]
        public bool Overwrite
        {
            get
            {
                return this.overwrite;
            }

            set
            {
                this.overwrite = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies the owner email for the new site collection.",
                Title = "Owner Email",
                Example = "support@collaboris.co.uk",
                Required = true,
                InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string OwnerEmail
        {
            get
            {
                return this.ownerEmail;
            }

            set
            {
                this.ownerEmail = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies the owner login for the new site collection.",
                Title = @"Owner Login",
                Example = @"local\administrator",
                Required = true,
                InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string OwnerLogin
        {
            get
            {
                return this.ownerLogin;
            }

            set
            {
                this.ownerLogin = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies the owner name for the new site collection.",
                Title = "Owner Name",
                Example = "Mark Jones",
                Required = true,
                InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string OwnerName
        {
            get
            {
                return this.ownerName;
            }

            set
            {
                this.ownerName = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies the secondary contact email for the new site collection.",
                Title = "Secondary Contact Email",
                Example = "suppor2@collaboris.co.uk",
                Required = false,
                InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string SecondaryContactEmail
        {
            get
            {
                return this.secondaryContactEmail;
            }

            set
            {
                this.secondaryContactEmail = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies the secondary contact login for the new site collection.",
                Title = "Secondary Contact Login",
                Example = @"local\administrator",
                Required = false,
                InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string SecondaryContactLogin
        {
            get
            {
                return this.secondaryContactLogin;
            }

            set
            {
                this.secondaryContactLogin = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies the secondary contact name for the new site collection.",
                Title = "Secondary Contact Name",
                Example = "Hugo Esperanca",
                Required = false,
                InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string SecondaryContactName
        {
            get
            {
                return this.secondaryContactName;
            }

            set
            {
                this.secondaryContactName = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies the title for the new site collection.",
                Title = "Title",
                Example = "New Saf Site",
                Required = true,
                InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string Title
        {
            get
            {
                return this.title;
            }

            set
            {
                this.title = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies the relative URL of the new site.",
                Title = "Site Collection url",
                Example = "sites/newSafSite",
                Required = true,
                InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string SiteCollectionUrl
        {
            get
            {
                return this.url;
            }

            set
            {
                this.url = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies whether to use the host header as site name.",
                Title = "Use Host Header As Site Name",
                Example = "false",
                Required = false,
                InputHint = InputHint.Boolean)]
        [XmlAttribute]
        public bool UseHostHeaderAsSiteName
        {
            get
            {
                return this.useHostHeaderAsSiteName;
            }

            set
            {
                this.useHostHeaderAsSiteName = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies the parent web application URL that will contain the new site.",
                Title = "Web Application Url",
                Example = "${CurrentWebApp.DefaultUrl}",
                Required = true,
                InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string WebApplicationUrl
        {
            get
            {
                return this.webApplicationUrl;
            }

            set
            {
                this.webApplicationUrl = value;
            }
        }

        [CollaborisProperty(
                Summary = "Specifies the template to base the new site upon.",
                Title = "Use Host Header As Site Name",
                Example = "STS#1",
                Required = true,
                InputHint = InputHint.SingleText)]
        [XmlAttribute]
        public string WebTemplate
        {
            get
            {
                return this.webTemplate;
            }

            set
            {
                this.webTemplate = value;
            }
        }

        #endregion
    }
}
